package com.afkt.project.ui.slice;


import com.afkt.project.base.app.BaseActivity;
import com.afkt.project.model.item.ButtonList;
import com.afkt.project.model.item.ButtonValue;
import com.afkt.project.ui.adapter.AssistAdapter;
import com.afkt.project.ui.adapter.ButtonAdapter;
import com.afkt.project.util.SkipUtils;
import com.ohos.afkt.ResourceTable;
import ohos.aafwk.content.Intent;
import ohos.agp.components.*;

public class ViewAssitSlice extends BaseActivity {


    private DirectionalLayout bar_layout;

    private DirectionalLayout ui_bar;

    private ListContainer UI_list;

    private Image select_retuen;

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
    }

    @Override
    protected void onActive() {
        super.onActive();
    }

    @Override
    protected int baseLayoutId() {
        return ResourceTable.Layout_view_assit_helper;
    }

    @Override
    protected void initView() {
        bar_layout = (DirectionalLayout) findComponentById(ResourceTable.Id_assit_bar_layout);
        ui_bar = (DirectionalLayout) LayoutScatter.getInstance(this).parse(ResourceTable.Layout_ui_bar, null, false);
        Text text = (Text) ui_bar.findComponentById(ResourceTable.Id_title_name);
        select_retuen = (Image) ui_bar.findComponentById(ResourceTable.Id_ui_return);
        text.setText("View 填充辅助类");
        bar_layout.removeAllComponents();
        bar_layout.addComponent(ui_bar);
        UI_list = (ListContainer) findComponentById(ResourceTable.Id_Assit_List);
        AssistAdapter assistAdapter = new AssistAdapter(ButtonList.getViewAssistButtonValues(), this);
        UI_list.setItemProvider(assistAdapter);
    }

    @Override
    protected void initListener() {
        select_retuen.setClickedListener(component -> {
            // LogUtils.error(TAG, "return 点击");
            onBackPressed();
        });
    }

    @Override
    protected void onBackground() {
        //bar_layout.removeComponent(ui_bar);
        //bar_layout.removeAllComponents();
        super.onBackground();

    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
